#ifndef PropulsionH
#define PropulsionH
#include <MOOSLIB/MOOSApp.h>
#include <vector>
using namespace std;

typedef struct _state{
	double u;
	double v;
	double w;
	
	double p;
	double q;
	double r;
	
	double x;
	double y;
	double z;
	
	double phi;
	double theta;
	double psi;	
} state;

//A function pointer to void fun(vector<double>&, vector<double>&)
typedef void (*FUNC_PTR_Propulsion)(vector<double>& vdblControls, state& sState, vector<double>& vdblPropulsion);

class CPropulsion : public CMOOSApp
{
public:
        CPropulsion();
        CPropulsion(FUNC_PTR_Propulsion fptrPropulsion);
        virtual ~CPropulsion();
protected:
        bool OnNewMail(MOOSMSG_LIST &NewMail);
        bool Iterate();
        bool OnConnectToServer();
        bool OnStartUp();
        /*We want to subscribe to "Control". Control values are obtained from the controllers*/
        void DoRegistrations();
        bool OnControl(CMOOSMsg& msg);
        bool OnState(CMOOSMsg& msg);
private:
		FUNC_PTR_Propulsion _fptrPropulsion;
		state _statePrev;
		vector<double> _ctrlPrev;
};
#endif

